////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2008 Michiel Helvensteijn                                    //
//                                                                            //
// This file is part of the Mist compiler.                                    //
//                                                                            //
// The Mist compiler is free software: you can redistribute it and/or modif   //
// it under the terms of the GNU General Public License as published by       //
// the Free Software Foundation, either version 3 of the License, or          //
// (at your option) any later version.                                        //
//                                                                            //
// The Mist compiler is distributed in the hope that it will be useful,       //
// but WITHOUT ANY WARRANTY; without even the implied warranty of             //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              //
// GNU General Public License for more details.                               //
//                                                                            //
// You should have received a copy of the GNU General Public License          //
// along with the Mist compiler.  If not, see <http://www.gnu.org/licenses/>. //
////////////////////////////////////////////////////////////////////////////////

#ifndef CPPVISITOR_HPP
#define CPPVISITOR_HPP

/******************************************************************************
 * Includes                                                                   *
 ******************************************************************************/

#include <boost/shared_ptr.hpp>
using boost::shared_ptr;

#include "outputproducer.hpp"

class Node;
class Declarations;

/******************************************************************************
 * CPP Functions                                                              *
 ******************************************************************************/

class cpp : public OutputProducer<Node> {
	public:
		
		cpp(shared_ptr<Node> tree, unsigned tabSize = 4);
		
		operator string() const;
		
		ostream& send_to_stream(ostream& out) const;
	
	private:
		
		shared_ptr<Node> _tree;
		unsigned _tabSize;
};

/******************************************************************************/

class cppProgram : public OutputProducer<Declarations> {
	public:
		
		cppProgram(shared_ptr<Declarations> tree, unsigned tabSize = 4);
		
		operator string() const;
		
		ostream& send_to_stream(ostream& out) const;
	
	private:
		
		shared_ptr<Declarations> _tree;
		unsigned _tabSize;
};

/******************************************************************************
 * Functions Public for Unit Tests                                            *
 ******************************************************************************/

class Path;
string to_cpp_name(const Path& path);

#endif // CPPVISITOR_HPP
